﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using University.Workshop.Business;

namespace University.Workshop.WebApp
{
    public partial class GiftCards : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GridView1.DataSource = GiftCardManager.GridGiftLoad();
                GridView1.DataBind();
            }
        }

        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                GridViewRow row = GridView1.SelectedRow;
                productId.Text = row.Cells[1].Text;
                productName.Text = row.Cells[2].Text;
                Response.Redirect("ProductSelected.aspx?ProductID=" + productId.Text + "&ProductName=" + productName.Text + "&ProductPrice=" + row.Cells[4].Text + "&ProductCategory=" + row.Cells[3].Text);
                
            }
            catch
            {
                LabelMessage.Text = "No rows Selected";
            }
        }
    }
}